from ..PSData import *
from .DataABC import DataABC

class DataManager(PSDataServer):
    def __init__(self) -> None:
        super().__init__()
        self._dataRoot = DataABC('Root')

    def GetData(self, data: 'PSData') -> 'PSData':
        '''
        Function:
            获取一个Data对象
        args:
            [in]
            data.header = 'GetData',
            data.args = {
                'path': List | str
                'split': str
            },
            [out]
            data.value = {
                'data': DataABC
            }
        '''
        path_ = data.args.get('path')
        if (isinstance(path_, list)):
            data.value['data'] = self._dataRoot.Get(path_)
        elif (isinstance(path_, str)):
            split_ = data.args.get('split', '.')
            data.value['data'] = self._dataRoot.Get(path_, split_)
        return data

